#include <string>
#include <memory>
#include "HttpServer.hpp"
#include <ctime>
#include "Log.hpp"

static void Usage(char* arg)
{
    std::cout << "Usage:\n\t" << arg << "port" << std::endl;    
}

// ./TcpServer + port
int main(int argc , char* argv[])
{
    LOG(INFO , "debug project");
    std::cout << time(nullptr) << std::endl;
    if (argc != 2)
    {
      Usage(argv[0]);
      exit(4);
    }

    int port = atoi(argv[1]);
    
    //创建一个智能指针对象,防止未释放内存造成内存泄漏问题
    std::shared_ptr<HttpServer> http_server(new HttpServer(port));
    http_server->InitServer();
    http_server->Loop();
    return 0;
}
